package kaang.dev.warpimage;

import android.view.MotionEvent;

class SurfaceWidget {
    ISurfaceWidgetOnTouchListener m_listener;
    SurfaceWidget m_parent;
    public Vector2D m_pos;
    public boolean m_visible;

    SurfaceWidget() {
        Vector2D localVector2D = new Vector2D();
        this.m_pos = localVector2D;
        this.m_parent = null;
        this.m_visible = true;
        this.m_listener = null;
    }

    float GetHeight() {
        return 0.0F;
    }

    float GetWidth() {
        return 0.0F;
    }

    Vector2D GetWorldPos() {
        Vector2D localVector2D2;
        if (this.m_parent == null) {
            Vector2D localVector2D1 = this.m_pos;
            localVector2D2 = new Vector2D(localVector2D1);
        } else {
            localVector2D2 = this.m_parent.GetWorldPos();
            float f1 = localVector2D2.m_posX;
            float f2 = this.m_pos.m_posX;
            float f3 = f1 + f2;
            localVector2D2.m_posX = f3;
            float f4 = localVector2D2.m_posY;
            float f5 = this.m_pos.m_posY;
            float f6 = f4 + f5;
            localVector2D2.m_posY = f6;
        }
        return localVector2D2;
    }

    boolean OnTouch(float paramFloat1, float paramFloat2, MotionEvent paramMotionEvent) {
        int i = 0;
        float f5 = 0;
        float f4 = 0;
        float f8 = 0;
        if (!this.m_visible) {
            Vector2D localVector2D = GetWorldPos();
            float f1 = localVector2D.m_posX;
            if (paramFloat1 < f1) {
                float f2 = localVector2D.m_posX;
                float f3 = GetWidth();
                f4 = f2 + f3;
            }
            if (paramFloat1 >= f4) {
                f5 = localVector2D.m_posY;
            }
            if (paramFloat2 < f5)

            {
                float f6 = localVector2D.m_posY;
                float f7 = GetHeight();
                f8 = f6 + f7;
            }
            if (paramFloat2 >= f8)

                if ((this.m_listener != null) && (paramMotionEvent.getAction() == 0))
                    this.m_listener.OnClick();
            i = 1;
        }
        return m_visible;
    }

    void SetOnTouchListener(ISurfaceWidgetOnTouchListener paramISurfaceWidgetOnTouchListener) {
        this.m_listener = paramISurfaceWidgetOnTouchListener;
    }

    void SetParent(SurfaceWidget paramSurfaceWidget) {
        this.m_parent = paramSurfaceWidget;
    }
}